<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<title>文档列表 - 光年(Light Year Admin)后台管理系统模板</title>
<script type="text/javascript"
	src="${APP_PATH }/public/js/jquery.min.js"></script>
<script type="text/javascript"
	src="${APP_PATH }/public/js/bootstrap.min.js"></script>
<script type="text/javascript"
	src="${APP_PATH }/public/js/perfect-scrollbar.min.js"></script>
<script type="text/javascript" src="${APP_PATH }/public/js/main.min.js"></script>
<script type="text/javascript" src="${APP_PATH }/public/js/Chart.js"></script>
<script src="${APP_PATH }/public/layer/layer.js"></script>
<link rel="icon" href="${APP_PATH }/public/favicon.ico" type="image/ico">
<link href="${APP_PATH }/public/css/bootstrap.min.css" rel="stylesheet">
<link href="${APP_PATH }/public/css/materialdesignicons.min.css"
	rel="stylesheet">
<link href="${APP_PATH }/public/css/style.min.css" rel="stylesheet">
</head>

<body>
	<div class="lyear-layout-web">
		<div class="lyear-layout-container">
			<!--左侧导航-->
			<jsp:include page="${APP_PATH }/head.jsp"></jsp:include>
			<!--End 左侧导航-->
			<jsp:include page="${APP_PATH }/menu.jsp"></jsp:include>


			<!--页面主要内容-->
			<main class="lyear-layout-content">

				<div class="container-fluid">

					<div class="row">
						<div class="col-lg-12">
							<div class="card">
								<div class="card-toolbar clearfix">
									<form class="pull-right search-bar" role="form">
										<div class="input-group">
											<input type="text" class="form-control has-success"
												name="info" id="info" placeholder="请输入学生姓名或学号">
										<button type="button" class="btn btn-warning" id="btnSelect">
											<i class="glyphicon glyphicon-search"></i> 查询
										</button>
										</div>
									</form>
								</div>
								<div class="card-body">

									<div class="table-responsive">
										
											<table class="table table-bordered">
												<thead>
													<tr>
														<th align="center">编号</th>
														<th align="center">公司ID</th>
														<th align="center">公司名称</th>
														<th align="center">学生姓名</th>
														<th align="center">状态</th>
														<th align="center">老师点评</th>
														<th align="center">公司评价</th>
														<th align="center">面试心得</th>
													</tr>
												</thead>
												<tbody id="tbody">

												</tbody>
											</table>
									</div>
									<ul class="pagination" id="byPage">

									</ul>

								</div>
							</div>
						</div>
					</div>

				</div>

			</main>
			<!--End 页面主要内容-->
		</div>
	</div>
	<script type="text/javascript">
		$(document)
				.ready(
						function() {
							$('.search-bar .dropdown-menu a')
									.click(
											function() {
												var field = $(this).data(
														'field')
														|| '';
												$('#search-field').val(field);
												$('#search-btn')
														.html(
																$(this).text()
																		+ ' <span class="caret"></span>');
											});
							show(1);
							$("#btnSelect").click(function() {
								show(1);
							});

						});
		function show(pageNum) {
             
			var info = $("#info").val();
			
					$.ajax({
						url : "${APP_PATH}/company/teacherwithresultindex",
						type : "post",
						data : {
							"pageNum" : pageNum,
							"info" : info
						},
						success : function(obj) {
							if (obj.result) {
								var message = "";
								$
										.each(
												obj.interviewResultList,
												function(index, interviewResult) {
													message += '<tr>';
													message += '<td>'
															+ (index + 1)
															+ '</td>';
													message += '<td>'
															+ interviewResult.companyUser.uid
															+ '</td>';
													message += '<td>'
															+ interviewResult.companyUser.uname
															+ '</td>';
												    message += '<td>'
															+ interviewResult.studentUser.uname
															+ '</td>';
													message += '<td>'
															+ interviewResult.result
															+ '</td>';
													message += '<td>'
																+ interviewResult.review
																+ '</td>';
													message += '<td>'
																+ interviewResult.comments
																+ '</td>';
													message += '<td>'
																+ interviewResult.tips
																+ '</td>';
													message += '</tr>';
													
												});
								$("#tbody").html(message);
								var pageMessage = "";
								pageMessage += '<li class="'
										+ (obj.pageInfo.pageNum == 1 ? "disabled"
												: "") + '"><a onclick="show('
										+ obj.pageInfo.prePage
										+ ')">上一页</a></li>';
								for (var i = 1; i <= obj.pageInfo.pages; i++) {
									pageMessage += '<li class="'
											+ (obj.pageInfo.pageNum == i ? "active"
													: "")
											+ '"><a onclick="show('
											+ i
											+ ')">'
											+ i
											+ ' <span class="sr-only">(current)</span></a></li>';
								}
								pageMessage += '<li class="'
										+ (obj.pageInfo.pageNum == obj.pageInfo.pages ? "disabled"
												: "") + '"><a onclick="show('
										+ obj.pageInfo.nextPage
										+ ')">下一页</a></li>';
								$("#byPage").html(pageMessage);
							}
						}
					});
		}

		
	</script>
</body>
</html>